<?php
header('Content-type:text/html;charset=utf-8');
if(!empty($_POST['btn'])) {
    $num1 = $_POST['num1'];
    $num2 = $_POST['num2'];
    $a = '';
    if ($_POST['sel'] == '+') {
        $a = $num1 + $num2;
    } elseif ($_POST['sel'] == '-') {
        $a = $num1 - $num2;
    } elseif ($_POST['sel'] == '*') {
        $a = $num1 * $num2;
    } elseif ($_POST['sel'] == '/') {
        $a = $num1 / $num2;
    }
}
//    if(isset($_POST['button'])):
//        $num=(int)$_POST['num'];
//        if($num==''||!is_numeric($num)):
//            echo '请输入数字';
//        else:
//            $num+=0;
//            if(is_int($num)):
//                echo $num%2==0?"{$num}是偶数":"{$num}是奇数";
//             else:
//                echo '您输入的不是整数';
//            endif;
//        endif;
//    endif;
?>
<form method="post" action="">
<!--    请输入一个数：<input type="text" name="num"><br/>-->
<!--    <input type="submit" name="button" value="判断奇偶数">-->
    <input type="text" name="num1"/>
    <select name="sel">
        <option value="+">+</option>
        <option value="-">-</option>
        <option value="*">*</option>
        <option value="/">/</option>
    </select>
    <input type="text" name="num2"/>
    <input type="button" name="yun" value="=">
    <input type="text" name="sum" value="<?php echo $a ?>">
    <input type="submit" name="btn" value="计算">
</form>